import {
    observable,
    action
} from "mobx-miniprogram";
export const rectificationIndexFilterStore = observable({
    listApi: null,

    activedTab: 'assetType',
    //    单元目录
    directory: [],
    //    资产类型
    assetsType: [],
    //    巡检人
    inspectUserIdList: [],
    //    整改状态 -1超时未整改 0待整改 1已整改
    isRectify: [],
    //    整改结束时间
    rectifyEndTime: '',
    //    整改开始时间
    rectifyStartTime: '',
    //    整改人
    rectifyUserIdList: [],
    //    使用科室
    useDept: [],
    setListApi: action(function (val) {
        this.listApi = val
    }),
    // 设置资产类型
    setAssetsType: action(function (val) {
        this.assetsType = val.map(item => item.value)
    }),
    // 设置单元目录
    setDirectory: action(function (val) {
        this.directory = val.map(item => item.value)
    }),
    setUseDept: action(function (val) {
        this.useDept = val.map(item => item.value)
    }),
    setActivedTab: action(function (val) {
        this.activedTab = val
    }),
    // 设置整改状态
    setRectify: action(function (e) {
        this.isRectify = e.detail.value
        console.log(e.detail);
    }),
    //设置整改时间
    setRectifyDate: action(function (e) {
        this.rectifyStartTime = e.detail.value[0]
        this.rectifyEndTime = e.detail.value[1]

    }),

    // 设置整改人
    setRectifyUserIdList: action(function (list) {
        this.rectifyUserIdList = list.map(item => item.userId)
    }),
    // 设置巡检人
    setInspectUserIdList: action(function (list) {
        this.inspectUserIdList = list.map(item => item.userId)
    }),

    // 重置
    rectificationIndexDetailStoreReset: action(function () {
        this.directory = ''
        this.assetsType = ''
        this.inspectUserIdList = []
        this.isRectify = []
        this.rectifyEndTime = ''
        this.rectifyStartTime = ''
        this.rectifyUserIdList = []
        this.useDept = []
    })


});